package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DbAddressMapper;
import com.ruoyi.system.domain.DbAddress;
import com.ruoyi.system.service.IDbAddressService;

/**
 * 地址Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-08
 */
@Service
public class DbAddressServiceImpl implements IDbAddressService
{
    @Autowired
    private DbAddressMapper dbAddressMapper;

    /**
     * 查询地址
     *
     * @param id 地址主键
     * @return 地址
     */
    @Override
    public DbAddress selectDbAddressById(Long id)
    {
        return dbAddressMapper.selectDbAddressById(id);
    }

    /**
     * 查询地址列表
     *
     * @param dbAddress 地址
     * @return 地址
     */
    @Override
    public List<DbAddress> selectDbAddressList(DbAddress dbAddress)
    {
        return dbAddressMapper.selectDbAddressList(dbAddress);
    }

    /**
     * 新增地址
     *
     * @param dbAddress 地址
     * @return 结果
     */
    @Override
    public int insertDbAddress(DbAddress dbAddress)
    {
        dbAddress.setCreateTime(DateUtils.getNowDate());
        return dbAddressMapper.insertDbAddress(dbAddress);
    }

    /**
     * 修改地址
     *
     * @param dbAddress 地址
     * @return 结果
     */
    @Override
    public int updateDbAddress(DbAddress dbAddress)
    {
        dbAddress.setUpdateTime(DateUtils.getNowDate());
        return dbAddressMapper.updateDbAddress(dbAddress);
    }


    /**
     * 批量删除地址
     *
     * @param ids 需要删除的地址主键
     * @return 结果
     */
    @Override
    public int deleteDbAddressByIds(Long[] ids)
    {
        return dbAddressMapper.deleteDbAddressByIds(ids);
    }

    /**
     * 删除地址信息
     *
     * @param id 地址主键
     * @return 结果
     */
    @Override
    public int deleteDbAddressById(Long id)
    {
        return dbAddressMapper.deleteDbAddressById(id);
    }
}
